package com.dataart.productshop.controller;

import com.dataart.productshop.Constants;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.File;

import static org.junit.Assert.assertTrue;


@RunWith(SpringJUnit4ClassRunner.class)
//!! real database - not test
@ContextConfiguration(locations = {"file: src/main/resources/spring/application-context.xml"})
public class ControllerModule{

    @Value(Constants.DEFAULT_IMAGE_URL)
    String defaultImageUrl;

    @Test
    public void testExistsDefaultPicture(){
        File defaultImage = new File(defaultImageUrl);
        assertTrue(defaultImage.exists());
        assertTrue(defaultImage.isFile());
    }
}
